package com.want.client.instance.list.impl;

import com.want.client.instance.list.ServiceInstanceListService;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;

import javax.annotation.Resource;
import java.util.List;

/**
 * 默认的服务实例列表获取类
 *
 * @author WangZhiJian
 * @since 2021/12/19 0019
 */
public class DefaultServiceInstanceListService implements ServiceInstanceListService {

    @Resource
    private DiscoveryClient discoveryClient;

    @Override
    public List<ServiceInstance> listServiceInstance(String serviceName) {
        return discoveryClient.getInstances(serviceName);
    }
}
